package cn.wx.scholar.neo4j.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import cn.wx.common.persistence.base.BaseController;
import cn.wx.common.persistence.web.ResponseData;
import cn.wx.scholar.neo4j.entity.qo.Neo4jNewsQ;
import cn.wx.scholar.neo4j.service.Neo4jNewsService;

/**
 *   @description : 新闻  控制器
 *   ---------------------------------
 *   @author  
 *   @since 2018-07-14
 */
@RestController
@RequestMapping("/sholar/neo4j/news")
public class Neo4jNewsController extends BaseController {
	
	@Autowired
    private Neo4jNewsService neo4jNewsService;
	
	/**
	 * 根据专家的Id获取该专家所有的新闻数据
	 * @param id
	 * @return
	 */
    @RequestMapping(value = "/getNews", method = RequestMethod.POST)
	public ResponseData getNewsById(Neo4jNewsQ neo4jNewsQ){
		return success(neo4jNewsService.findAllNewsById(neo4jNewsQ));
    }
    
    /**
	 * 根据新闻id获取新闻详情
	 * @param id
	 * @return
	 */
    @RequestMapping(value = "/queryUnique", method = RequestMethod.POST)
	public ResponseData queryUnique(@RequestParam(value = "id") Long id){
		return success(neo4jNewsService.findOneNews(id));
    }
    
}
